package com.as.server.controller;

import com.as.server.entity.Follow;
import com.as.server.service.FollowService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class FollowController {
    @Autowired
    FollowService service;
    @GetMapping("/FollowUidTo")
    public Page<Follow> FollowUidToPage(Long uidTo, int pageNum, int pageSize) {
       return  service.selectAllByUidtoPage(uidTo,pageNum,pageSize);
    }

    @GetMapping("/FollowUidFollow")
    public Page<Follow> FollowUidFollowPage(Long uidFollow, int pageNum, int pageSize) {
        return  service.selectAllByUidFollowPage(uidFollow,pageNum,pageSize);
    }

    @GetMapping("/Follow/insert")
    public String insert(@RequestBody Follow follow) {
        int res =service.insert(follow);
        if(res>0){
            return "success";
        }
        return  "fail";
    }
}
